//
//  NSUserDefaultsCategory.m
//  ubixar-utils
//
//  Created by Demis Bellot on 17/04/2009.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "NSUserDefaultsCategory.h"

@implementation NSUserDefaults(NSUserDefaultsCategory)

- (void)encodeObject:(id <NSCoding>)anObject forKey:(NSString*)aKey
{
	// Requires 10.2 or later for keyed archiving
	NSData* theData = [NSKeyedArchiver archivedDataWithRootObject:anObject];
	[self setObject:theData forKey:aKey];
}

- (id)decodeObjectForKey:(NSString*)aKey
{
	// Requires 10.2 or later for keyed archiving
	NSData* theData = [self dataForKey:aKey];
	return (theData != nil) ? [NSKeyedUnarchiver unarchiveObjectWithData:theData] : nil;
}
@end
